import re
import logging

BUS = 0
TRAM = 1
TROLLEY = 2

TRANSPORT_TYPES = [BUS, TRAM, TROLLEY]

re_stop = re.compile(r'\(([0-9]{4})\) (.*)$')

def getStopCodeFromLabel(label):
    match = re_stop.match(label)
    if match:
        return match.group(1)

def getStopNameFromLabel(label):
    match = re_stop.match(label)
    if match:
        return match.group(2)
    
    
class _NullHandler(logging.Handler):
    def emit(self, record):
        pass
